package com.ruoyi.guestInfo.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.guestInfo.domain.WdmOrgGuest;
import com.ruoyi.guestInfo.service.IWdmOrgGuestService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * B端团体用户（需提交资质证明）Controller
 * 
 * @author lql
 * @date 2025-05-04
 */
@RestController
@RequestMapping("/guestInfo/orgguest")
public class WdmOrgGuestController extends BaseController
{
    @Autowired
    private IWdmOrgGuestService wdmOrgGuestService;

    /**
     * 查询B端团体用户（需提交资质证明）列表
     */
    @PreAuthorize("@ss.hasPermi('guestInfo:orgguest:list')")
    @GetMapping("/list")
    public TableDataInfo list(WdmOrgGuest wdmOrgGuest)
    {
        startPage();
        List<WdmOrgGuest> list = wdmOrgGuestService.selectWdmOrgGuestList(wdmOrgGuest);
        return getDataTable(list);
    }

    /**
     * 导出B端团体用户（需提交资质证明）列表
     */
    @PreAuthorize("@ss.hasPermi('guestInfo:orgguest:export')")
    @Log(title = "B端团体用户（需提交资质证明）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WdmOrgGuest wdmOrgGuest)
    {
        List<WdmOrgGuest> list = wdmOrgGuestService.selectWdmOrgGuestList(wdmOrgGuest);
        ExcelUtil<WdmOrgGuest> util = new ExcelUtil<WdmOrgGuest>(WdmOrgGuest.class);
        util.exportExcel(response, list, "B端团体用户（需提交资质证明）数据");
    }

    /**
     * 获取B端团体用户（需提交资质证明）详细信息
     */
    @PreAuthorize("@ss.hasPermi('guestInfo:orgguest:query')")
    @GetMapping(value = "/{orgId}")
    public AjaxResult getInfo(@PathVariable("orgId") Long orgId)
    {
        return success(wdmOrgGuestService.selectWdmOrgGuestByOrgId(orgId));
    }

    /**
     * 新增B端团体用户（需提交资质证明）
     */
    @PreAuthorize("@ss.hasPermi('guestInfo:orgguest:add')")
    @Log(title = "B端团体用户（需提交资质证明）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WdmOrgGuest wdmOrgGuest)
    {
        return toAjax(wdmOrgGuestService.insertWdmOrgGuest(wdmOrgGuest));
    }

    /**
     * 修改B端团体用户（需提交资质证明）
     */
    @PreAuthorize("@ss.hasPermi('guestInfo:orgguest:edit')")
    @Log(title = "B端团体用户（需提交资质证明）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WdmOrgGuest wdmOrgGuest)
    {
        return toAjax(wdmOrgGuestService.updateWdmOrgGuest(wdmOrgGuest));
    }

    /**
     * 删除B端团体用户（需提交资质证明）
     */
    @PreAuthorize("@ss.hasPermi('guestInfo:orgguest:remove')")
    @Log(title = "B端团体用户（需提交资质证明）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{orgIds}")
    public AjaxResult remove(@PathVariable Long[] orgIds)
    {
        return toAjax(wdmOrgGuestService.deleteWdmOrgGuestByOrgIds(orgIds));
    }
}
